using System;
using System.Linq;
using System.ServiceModel;

namespace Caramel.ServiceModel
{
	public class ServiceLocatorServiceHost : ServiceHost
	{
		public ServiceLocatorServiceHost()
		{
		}

		public ServiceLocatorServiceHost(Type serviceType, params Uri[] baseAddresses)
			: base(serviceType, baseAddresses)
		{
		}

		protected override void OnOpening()
		{
			this.
				Description.
				Behaviors.
				Add(
					new ServiceLocatorInstanceProviderServiceBehavior()
				);

			this.
				Description.
				Behaviors.
				Add(
					new PerCallLocalStorageServiceBehavior()
				);

 			base.OnOpening();
		}
	}
}
